home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / fp / ifp_unix.lzh / ifp / interp / debug.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-23  |  2.6 KB  |  81 lines

  1.  
  2. /****** debug.c *******************************************************/
  3. /**                                                                  **/
  4. /**                    University of Illinois                        **/
  5. /**                                                                  **/
  6. /**                Department of Computer Science                    **/
  7. /**                                                                  **/
  8. /**   Tool: IFP                         Version: 0.5                 **/
  9. /**                                                                  **/
  10. /**   Author:  Arch D. Robison          Date:   May 1, 1985          **/
  11. /**                                                                  **/
  12. /**   Revised by: Arch D. Robison       Date:   Dec 5, 1985          **/
  13. /**                                                                  **/
  14. /**   Principal Investigators: Prof. R. H. Campbell                  **/
  15. /**                            Prof. W. J. Kubitz                    **/
  16. /**                                                                  **/
  17. /**                                                                  **/
  18. /**------------------------------------------------------------------**/
  19. /**   (C) Copyright 1987  University of Illinois Board of Trustees   **/
  20. /**                       All Rights Reserved.                       **/
  21. /**********************************************************************/
  22.  
  23.  
  24. #include <stdio.h>
  25. #include "struct.h"
  26. #include "string.h"
  27.  
  28. #if DEBUG
  29. int Debug = 0;     /* Print debugging statements if true */
  30. #endif
  31.  
  32. #if DUMP
  33.  
  34.  
  35. /*
  36.  * DumpNode
  37.  *
  38.  * Print out node N and all its decendants.
  39.  */
  40. void DumpNode (N,Indent)
  41.    register NodePtr N;
  42.    int Indent;
  43.    {
  44.       extern void OutIndent ();
  45.  
  46.       OutIndent (3*Indent);
  47.       if (N == NULL) printf ("DumpNode: N = NULL\n");
  48.       else {
  49.      OutString (N->NodeName);
  50.      switch (N->NodeType) {
  51.          case NEWNODE: printf ("(new) "); break;
  52.          case MODULE:
  53.         printf (" module\n");
  54.         for (N = N->NodeData.NodeMod.FirstChild; N!=NULL; N=N->NodeSib)
  55.            DumpNode (N,Indent+1);
  56.         break;
  57.          case DEF:
  58.            printf (" function");
  59.            if (N->NodeData.NodeDef.DefFlags & TRACE)
  60.           printf ("(trace) ");
  61.            OutObject (&N->NodeData.NodeDef.DefCode);
  62.            printf ("\n");
  63.            break;
  64.         case IMPORT:
  65.            printf (" import");
  66.            OutObject (&N->NodeData.NodeImp.ImpDef);
  67.            printf ("\n");
  68.            break;
  69.         default:
  70.            printf (" invalid NodeType (%x)\n",N->NodeType);
  71.            break;
  72.      }
  73.       }
  74.    }
  75.  
  76. #endif /* DUMP */
  77.  
  78.  
  79. /*************************** end of debug.c *********************************/
  80.  
  81.